<template>
  <div class="block">
    <el-table :data="delivery" stripe border class="seeker_table">
      <el-table-column
          prop="occupationName"
          label="求职职位">
      </el-table-column>
      <el-table-column
          prop="enterpriseName"
          label="企业">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      seekerId: 0,
      delivery: [],

    }
  },
  created() {
    const id = this.$route.query.id;
    if (typeof id === 'string') {
      this.seekerId = parseInt(id, 10); // 尝试将字符串转换为整数
    } else if (typeof id === 'number') {
      this.seekerId = id; // 如果已经是数字，直接赋值
    } else {
      console.error('Invalid seekerId type');
      return;
    }
    if (!isNaN(this.seekerId)) {
      this.fetchDeliveryById();
    } else {
      console.error('Invalid seekerId');
    }
  },
  methods: {
    fetchDeliveryById() {
      console.log(this.seekerId)
      this.$axios.post('/delivery/getAllDeliveryById',{seekerId: this.seekerId}).then(resp=>{
        this.delivery = resp.data
        console.log(this.delivery)
      })
    },
  },

  mounted() {

  },

}
</script>

<style scoped>

.seeker_table{
  width: 1400px;
}
.block {
  padding: 20px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
}

</style>